package com.gzw.scm.utils;



import com.gzw.scm.MyApplication;

import java.io.InputStream;
import java.util.Properties;

public class PropertiesUtil {
    public static String Read(String key) {
        String value = null;

        if (key.equals("IP")){
            value=SPUtils.get(MyApplication.getmContext(),key,"").toString();
            if (value.length()==0){
                Properties props = new Properties();
                try {
                    InputStream in = MyApplication.getmContext().getAssets().open("config.properties");
                    props.load(in);
                    value = props.getProperty(key);
                } catch (Exception e1) {
                    // TODO Auto-generated catch block
                    e1.printStackTrace();
                }
            }
        }else {
            Properties props = new Properties();
            try {
                InputStream in = MyApplication.getmContext().getAssets().open("config.properties");
                props.load(in);
                value = props.getProperty(key);
            } catch (Exception e1) {
                // TODO Auto-generated catch block
                e1.printStackTrace();
            }
        }
        return value;
    }

}
